package com.chaos.eurekaproducer.juc;

/**
 * @author liaopeng
 * @title: TicketWindow
 * @projectName eureka-producer
 * @description: 模拟营业厅叫号机程序
 * @date 2022/3/6下午10:20
 */
public class TicketWindow  extends Thread{
    //柜台名
    private final String name;
    //最多受理50笔业务
    private static final int MAX = 50;

    //设置静态
    private static int index = 1;

    public TicketWindow(String name) {
        this.name = name;
    }

    @Override
    public void run() {
        while (index <= MAX){
            System.out.println("柜台："+name+"当前号码是："+(index ++));
        }
    }

    public static void main(String[] args) {
        TicketWindow ticketWindow1 = new TicketWindow("一号初号机");
        ticketWindow1.start();
        TicketWindow ticketWindow2 = new TicketWindow("二号初号机");
        ticketWindow2.start();
        TicketWindow ticketWindow3 = new TicketWindow("三号初号机");
        ticketWindow3.start();
        TicketWindow ticketWindow4 = new TicketWindow("四号初号机");
        ticketWindow4.start();
    }
}
